/*
*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2011-2018 ARM or its affiliates
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#include "acamera_command_api.h"
//#include "acamera_firmware_api.h"
#include "acamera_firmware_settings.h"
// created from 2016-10-19T16:42:58.865Z UTClinear.json

// CALIBRATION_LIGHT_SRC
static uint16_t _calibration_light_src[][2] = {
    {285,234}};

// CALIBRATION_RG_POS
static uint16_t _calibration_rg_pos[] = {164,179,195,212,228,245,256,278,294,311,327,344,360,377,412};

// CALIBRATION_BG_POS
static uint16_t _calibration_bg_pos[] = {128,148,162,177,191,206,220,235,256,264,278,293,307,322,350};

// CALIBRATION_MESH_RGBG_WEIGHT
static uint16_t _calibration_mesh_rgbg_weight[][15] = {
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 9, 61 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 25, 104, 256, 256 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 38, 152, 256, 256, 20 },
  { 0, 0, 0, 0, 0, 0, 0, 1, 8, 53, 189, 256, 256, 122, 0 },
  { 0, 0, 0, 0, 0, 0, 1, 11, 59, 210, 256, 256, 178, 15, 0 },
  { 0, 0, 0, 0, 0, 2, 9, 87, 233, 256, 256, 168, 29, 1, 0 },
  { 0, 0, 0, 0, 1, 17, 62, 256, 256, 256, 181, 31, 2, 0, 0 },
  { 0, 0, 0, 1, 14, 122, 256, 256, 256, 165, 33, 2, 0, 0, 0 },
  { 0, 0, 1, 29, 200, 256, 256, 256, 88, 12, 1, 0, 0, 0, 0 },
  { 0, 0, 5, 90, 256, 256, 256, 152, 30, 3, 0, 0, 0, 0, 0 },
  { 0, 0, 43, 256, 256, 256, 184, 22, 2, 0, 0, 0, 0, 0, 0 },
  { 0, 7, 256, 256, 244, 61, 18, 1, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 46, 256, 256, 37, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 1, 256, 256, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 33, 256, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }};

// CALIBRATION_MESH_LS_WEIGHT
static uint16_t _calibration_mesh_ls_weight[][15] = {
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 3, 4, 25, 42, 53, 57, 53, 42, 25, 4, 3, 0, 0 },
  { 0, 0, 4, 131, 157, 179, 193, 198, 193, 179, 157, 131, 4, 0, 0 },
  { 0, 0, 25, 157, 188, 214, 232, 238, 232, 214, 188, 157, 25, 0, 0 },
  { 0, 0, 42, 179, 214, 243, 255, 256, 255, 243, 214, 179, 42, 0, 0 },
  { 0, 0, 53, 193, 232, 255, 256, 256, 256, 255, 232, 193, 53, 0, 0 },
  { 0, 0, 57, 198, 238, 256, 256, 256, 256, 256, 238, 198, 57, 0, 0 },
  { 0, 0, 53, 193, 232, 255, 256, 256, 256, 255, 232, 193, 53, 0, 0 },
  { 0, 0, 42, 179, 214, 243, 255, 256, 255, 243, 214, 179, 42, 0, 0 },
  { 0, 0, 25, 157, 188, 214, 232, 238, 232, 214, 188, 157, 25, 0, 0 },
  { 0, 0, 4, 131, 157, 179, 193, 198, 193, 179, 157, 131, 4, 0, 0 },
  { 0, 0, 3, 4, 25, 42, 53, 57, 53, 42, 25, 4, 3, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }};

// CALIBRATION_MESH_COLOR_TEMPERATURE
static uint16_t _calibration_mesh_color_temperature[][15] = {
    { 211, 225, 240, 250, 266, 281, 291, 310, 324, 336, 346, 357, 370, 385, 385 },
  { 191, 210, 225, 241, 250, 267, 277, 296, 310, 325, 336, 347, 358, 372, 385 },
  { 183, 194, 214, 230, 245, 253, 267, 286, 300, 315, 328, 340, 350, 363, 385 },
  { 174, 186, 203, 219, 234, 250, 253, 275, 289, 304, 318, 333, 343, 354, 385 },
  { 166, 178, 190, 208, 223, 239, 249, 265, 279, 294, 308, 323, 336, 347, 385 },
  { 158, 169, 181, 194, 211, 227, 238, 254, 268, 283, 297, 312, 326, 339, 364 },
  { 154, 161, 174, 186, 199, 217, 227, 248, 258, 273, 287, 302, 316, 331, 355 },
  { 154, 154, 165, 178, 190, 205, 216, 236, 251, 262, 276, 291, 305, 320, 347 },
  { 140, 149, 154, 166, 178, 191, 200, 220, 235, 253, 261, 276, 290, 305, 336 },
  { 135, 144, 154, 162, 174, 187, 195, 214, 229, 245, 260, 270, 284, 299, 330 },
  { 132, 135, 145, 154, 166, 179, 187, 203, 218, 234, 253, 260, 274, 289, 320 },
  { 122, 129, 135, 145, 157, 170, 179, 195, 207, 223, 238, 257, 264, 278, 309 },
  { 112, 119, 126, 136, 146, 162, 171, 187, 200, 212, 227, 243, 260, 268, 299 },
  { 102, 109, 116, 124, 136, 147, 162, 179, 191, 201, 216, 232, 255, 260, 288 },
  { 100, 100, 100, 100, 112, 120, 125, 163, 175, 188, 200, 210, 225, 242, 268 }};

// RG, BG, MULT. final wb gain adjuster for a sky scene. devided by CALIBRATION_WB_STRENGTH_MULT in use
static uint16_t _calibration_wb_strength[] = {1000, 1000, 1000};

// lux threshold for sky
static uint16_t _calibration_sky_lux_th[] = {10000};

// 1D rg/bg readout from color_temp
static uint16_t _calibration_ct_rg_pos_calc[] = {179,202,218,256,289,298,349,371,393};

// 1D rg/bg readout from color_temp
static uint16_t _calibration_ct_bg_pos_calc[] = {335,302,286,256,230,223,183,165,148};

// CALIBRATION_COLOR_TEMP
static uint16_t _calibration_color_temp[] = {100,133,154,200,250,260,333,357,385};

// CALIBRATION_CT65POS
static uint16_t _calibration_ct65pos[] = {2};

// CALIBRATION_CT40POS
static uint16_t _calibration_ct40pos[] = {8};

// CALIBRATION_CT30POS
static uint16_t _calibration_ct30pos[] = {6};

// CALIBRATION_EVTOLUX_EV_LUT
static uint32_t _calibration_evtolux_ev_lut[] //evlog2
    = {398775, 444491, 477818, 528405, 620780, 744998, 821797, 1051295, 1308509, 1373840, 1436952, 1573912, 1656816, 1918045, 2075972, 2322504, 2494615};

// CALIBRATION_EVTOLUX_LUX_LUT
static uint32_t _calibration_evtolux_lux_lut[] = {20000, 18000, 16000, 14000, 12000, 10100, 8900, 5120, 2560, 2080, 1800, 1200, 1000, 500, 320, 160, 100};


// CALIBRATION_BLACK_LEVEL_R
static uint16_t _calibration_black_level_r[][2] = {
    {0, 256},
    {32, 256},
    {64, 256},
    {96, 256},
    {128, 256}};

// CALIBRATION_BLACK_LEVEL_GR
static uint16_t _calibration_black_level_gr[][2] = {
    {0, 256},
    {32, 256},
    {64, 256},
    {96, 256},
    {128, 256}};

// CALIBRATION_BLACK_LEVEL_GB
static uint16_t _calibration_black_level_gb[][2] = {
    {0, 256},
    {32, 256},
    {64, 256},
    {96, 256},
    {128, 256}};

// CALIBRATION_BLACK_LEVEL_B
static uint16_t _calibration_black_level_b[][2] = {
    {0, 256},
    {32, 256},
    {64, 256},
    {96, 256},
    {128, 256}};

// CALIBRATION_STATIC_WB
static uint16_t _calibration_static_wb[] = {490,256,256,470};
// RR RG RB GR GG GB BR BG BB
static uint16_t _calibration_mt_absolute_ls_a_ccm[] = {410, 32869, 32821, 32888, 458, 32850, 29, 33005, 464};

// RR RG RB GR GG GB BR BG BB
static uint16_t _calibration_mt_absolute_ls_d40_ccm[] = {410, 32881, 32809, 32868, 449, 32861, 23, 32963, 428};

// RR RG RB GR GG GB BR BG BB
static uint16_t _calibration_mt_absolute_ls_d50_ccm[] = {413, 32888, 32805, 32857, 443, 32866, 20, 32949, 417};

// CALIBRATION_SHADING_LS_A_R
static uint8_t _calibration_shading_ls_a_r[] = {117,72,53,46,42,41,39,38,37,37,36,36,36,35,35,35,35,36,36,36,37,37,38,38,39,40,42,45,47,51,59,74,97,67,53,45,42,40,39,38,37,36,36,36,35,35,35,35,35,35,36,36,36,37,37,38,39,40,42,44,46,50,58,68,83,61,49,43,41,39,38,37,37,36,36,35,35,35,35,35,35,35,35,36,36,37,37,38,38,40,41,43,45,48,54,61,74,57,47,42,40,39,38,37,36,36,35,35,35,34,34,34,35,35,35,35,36,36,37,38,38,39,40,42,45,47,52,58,66,53,45,42,40,38,37,37,36,35,35,35,34,34,34,34,34,35,35,35,36,36,37,37,38,39,40,42,44,47,50,55,61,51,43,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,35,35,36,36,37,38,38,39,41,43,46,49,53,56,48,43,41,39,38,37,36,35,35,34,34,34,34,34,34,34,34,34,35,35,36,36,37,37,38,39,41,43,45,49,53,52,47,42,40,39,38,37,36,35,35,34,34,34,33,33,33,34,34,34,34,35,35,36,36,37,38,39,40,42,45,48,51,50,45,42,40,38,37,37,36,35,34,34,34,33,33,33,33,33,34,34,34,34,35,36,36,37,38,38,40,42,44,47,51,48,44,41,40,38,37,36,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,40,41,44,47,50,47,44,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,46,50,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,46,49,46,43,41,39,38,37,36,35,35,34,33,33,33,32,32,32,32,33,33,33,34,34,35,36,36,37,38,39,41,43,46,49,45,43,41,39,38,37,36,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,41,43,46,49,45,43,40,39,38,37,36,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,41,43,45,49,45,43,41,39,38,37,36,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,40,43,46,49,45,43,41,39,38,37,36,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,40,43,46,49,45,43,41,39,38,37,36,35,34,34,34,33,33,32,32,32,32,33,33,33,34,34,35,35,37,37,38,39,41,43,46,49,45,43,41,39,38,37,36,35,35,34,33,33,33,32,32,32,32,33,33,33,34,34,35,36,36,37,38,39,41,43,46,49,45,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,33,33,33,33,34,34,35,36,37,37,38,39,41,43,46,50,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,39,41,44,47,50,46,44,42,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,40,42,44,47,51,47,44,42,40,39,37,37,36,35,35,34,34,33,33,33,33,33,33,34,34,34,35,36,36,37,38,39,40,42,44,48,51,48,45,42,40,39,38,37,36,35,35,34,34,34,33,33,33,33,34,34,34,35,35,36,36,37,38,39,40,43,45,48,52,49,46,43,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,34,35,35,36,37,37,38,39,41,43,46,49,53,51,47,43,41,40,38,37,37,36,35,35,34,34,34,34,34,34,34,34,35,35,35,36,37,37,38,40,41,44,46,50,54,53,48,44,42,40,39,38,37,36,36,35,35,34,34,34,34,34,35,35,35,35,36,36,37,38,39,40,42,44,47,51,55,57,50,45,43,41,39,38,37,36,36,36,35,35,35,34,34,35,35,35,35,36,36,37,37,38,39,41,43,45,48,52,56,61,52,46,43,41,40,38,38,37,36,36,35,35,35,35,35,35,35,35,35,36,37,37,38,39,40,42,43,46,49,53,58,68,56,47,44,42,40,39,38,37,37,36,36,36,35,35,35,35,35,36,36,36,37,38,38,39,40,42,44,47,50,55,60,77,60,49,45,43,41,40,39,38,37,37,36,36,36,36,36,36,36,36,36,37,37,38,39,40,41,43,45,48,52,57,64,86,61,51,46,44,42,40,39,38,38,37,37,36,36,36,36,36,36,36,37,37,38,38,39,40,42,44,47,49,53,59,68};

// CALIBRATION_SHADING_LS_A_G
static uint8_t _calibration_shading_ls_a_g[] = {100,66,50,43,40,39,38,37,36,36,36,35,35,35,35,35,35,35,35,36,36,36,37,37,38,39,41,43,45,48,55,68,86,62,49,42,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,35,36,36,37,37,38,39,40,42,44,47,54,63,75,57,46,41,39,38,37,36,36,35,35,35,35,34,34,34,35,35,35,35,36,36,36,37,37,38,40,41,43,46,51,56,67,53,44,40,39,38,37,36,36,35,35,35,34,34,34,34,34,34,35,35,35,36,36,37,37,38,39,41,43,45,49,54,61,50,43,40,38,37,36,36,35,35,35,34,34,34,34,34,34,34,34,35,35,36,36,36,37,38,39,40,42,45,48,51,56,48,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,34,35,35,35,36,36,37,37,38,40,41,44,47,50,52,46,41,39,38,37,36,35,35,34,34,34,34,33,33,33,34,34,34,34,35,35,36,36,37,37,38,39,41,43,46,49,49,44,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,41,43,45,48,47,43,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,39,40,42,45,48,46,42,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,37,39,40,42,45,47,45,42,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,40,42,44,47,44,41,39,38,37,36,35,35,34,34,33,33,33,33,32,32,33,33,33,33,34,34,35,35,36,36,37,38,40,41,44,47,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,34,34,35,35,36,36,37,38,39,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,32,32,32,32,32,32,33,33,34,34,34,35,36,36,37,38,39,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,34,34,34,35,36,36,37,38,39,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,34,34,35,35,36,36,37,38,40,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,40,41,44,47,43,41,39,38,37,36,35,35,34,34,33,33,33,33,32,32,33,33,33,33,34,34,35,35,36,37,37,38,40,42,44,47,44,42,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,33,34,34,35,35,36,37,37,39,40,42,44,47,44,42,40,38,37,36,36,35,35,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,39,40,42,45,48,45,42,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,41,43,45,48,46,43,41,39,38,37,36,35,35,35,34,34,34,33,33,33,33,34,34,34,34,35,35,36,36,37,38,39,41,43,46,49,47,44,41,39,38,37,36,36,35,35,35,34,34,34,34,34,34,34,34,34,35,35,35,36,37,37,38,40,42,44,46,50,48,44,41,40,38,37,37,36,35,35,35,34,34,34,34,34,34,34,34,34,35,35,36,36,37,38,39,40,42,44,47,51,50,46,42,40,39,38,37,36,36,35,35,35,34,34,34,34,34,35,34,35,35,36,36,37,37,38,39,41,43,45,48,52,53,47,43,41,39,38,37,37,36,36,35,35,35,34,34,34,35,34,35,35,35,36,36,37,37,38,40,41,43,46,49,53,57,50,44,41,40,39,38,37,36,36,36,35,35,35,35,35,35,35,35,35,36,36,37,37,38,39,40,42,44,47,50,55,62,52,45,42,40,39,38,37,37,36,36,36,35,35,35,35,35,35,35,36,36,36,37,38,38,39,41,43,45,48,52,57,70,56,46,43,41,40,39,38,37,37,36,36,36,35,35,35,35,36,36,36,36,37,37,38,39,40,42,44,46,49,54,60,77,57,47,43,42,40,39,38,37,37,37,36,36,36,36,36,36,36,36,36,37,37,38,38,39,41,42,44,47,50,55,63};

// CALIBRATION_SHADING_LS_A_B
static uint8_t _calibration_shading_ls_a_b[] = {97,65,50,43,40,38,37,36,36,35,35,35,35,35,34,35,35,35,35,35,36,36,37,37,38,39,41,42,44,47,55,66,83,61,49,42,40,38,37,36,36,35,35,35,35,34,34,35,35,35,35,35,36,36,37,37,38,39,40,42,44,47,54,61,74,57,46,41,39,38,37,36,36,35,35,35,34,34,34,34,34,35,35,35,36,36,36,37,37,39,40,41,43,46,50,55,66,53,44,40,39,38,37,36,35,35,35,34,34,34,34,34,34,34,35,35,36,36,36,37,37,38,39,41,43,45,48,53,60,50,42,40,38,37,37,36,35,35,34,34,34,34,34,34,34,34,34,35,35,36,36,37,37,38,39,40,42,44,47,51,55,47,41,39,38,37,36,35,35,35,34,34,34,33,34,34,34,34,34,35,35,35,36,37,37,38,39,40,42,44,47,49,51,45,41,39,38,37,36,35,35,34,34,34,33,33,33,33,34,34,34,35,35,35,36,36,37,38,38,39,41,43,46,49,49,44,40,39,37,37,36,35,35,34,34,34,33,33,33,33,34,34,34,34,35,35,36,36,37,37,38,39,41,43,45,48,46,43,40,38,38,37,36,35,34,34,34,33,33,33,33,33,33,33,34,34,35,35,35,36,37,37,38,39,40,42,45,47,45,42,40,38,37,36,36,35,34,34,33,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,39,40,42,44,47,44,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,38,40,42,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,32,32,33,33,33,34,34,34,35,36,36,37,38,38,40,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,32,32,33,33,33,34,34,34,35,35,36,37,37,38,40,41,43,46,42,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,33,33,33,34,34,34,35,36,36,37,37,38,39,41,43,46,42,40,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,37,38,39,41,43,45,42,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,37,38,39,41,43,45,42,40,39,37,37,36,35,35,34,34,33,33,32,32,32,32,32,33,33,33,34,34,35,35,36,37,37,38,39,41,43,45,42,40,39,38,37,36,35,35,34,34,33,33,33,32,32,32,33,33,33,34,34,34,35,35,36,37,37,38,40,41,43,45,42,40,39,38,37,36,35,35,34,34,33,33,33,32,32,32,33,33,33,33,34,34,35,36,36,37,37,38,40,42,43,46,42,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,34,34,34,35,36,37,37,38,38,40,42,44,46,43,41,39,38,37,36,36,35,34,34,33,33,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,39,40,42,44,46,43,41,40,38,37,36,36,35,35,34,34,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,39,40,42,44,47,44,42,40,39,37,36,36,35,35,34,34,33,33,33,33,33,33,34,34,34,34,35,35,36,37,37,38,39,41,42,45,48,45,42,40,39,38,37,36,35,35,34,34,34,33,33,33,33,34,34,34,34,35,35,36,36,37,37,38,40,41,43,45,48,46,43,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,34,34,35,35,36,36,37,37,38,40,41,43,46,49,47,44,41,40,38,37,36,36,35,35,35,34,34,34,34,34,34,34,34,35,35,35,36,36,37,38,39,40,42,44,47,50,49,45,42,40,39,38,37,36,36,35,35,35,34,34,34,34,34,35,35,35,35,36,36,37,37,38,39,41,42,45,47,51,52,47,42,41,39,38,37,36,36,36,35,35,35,34,34,35,35,35,35,35,36,36,36,37,38,38,40,41,43,45,48,52,56,49,44,41,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,36,36,36,37,37,38,39,40,42,44,46,49,53,61,52,45,42,41,39,38,37,36,36,36,35,35,35,35,35,35,35,36,36,36,37,37,38,38,39,41,43,45,47,51,55,68,55,46,43,41,40,38,37,37,36,36,36,35,35,35,35,35,36,36,36,36,37,37,38,39,40,41,43,46,48,53,58,75,56,47,43,41,40,39,38,37,37,36,36,36,35,35,35,36,36,36,36,37,37,37,38,39,41,42,44,46,49,54,61};

// CALIBRATION_SHADING_LS_TL84_R
static uint8_t _calibration_shading_ls_tl84_r[] = {113,72,53,46,42,40,39,38,37,37,36,36,36,35,35,35,36,36,36,36,37,37,38,38,39,40,42,44,47,51,59,73,94,66,52,44,41,40,39,37,37,36,36,36,35,35,35,35,35,35,36,36,36,37,37,38,39,40,41,44,46,49,57,67,81,60,49,43,41,39,38,37,37,36,35,35,35,35,35,35,35,35,35,36,36,36,37,38,38,40,41,43,45,48,54,60,72,56,46,42,40,39,38,37,36,36,35,35,35,34,34,34,35,35,35,35,36,36,37,37,38,39,40,42,44,47,51,57,65,53,44,41,40,38,37,37,36,35,35,34,34,34,34,34,34,34,35,35,35,36,36,37,38,38,40,41,44,46,50,54,60,50,43,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,35,35,36,36,37,38,38,39,41,43,46,49,53,55,48,42,41,39,38,37,36,35,35,34,34,34,33,33,33,34,34,34,35,35,35,36,36,37,38,39,40,42,45,48,52,52,46,42,40,39,37,37,36,35,35,34,34,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,40,42,44,48,51,49,45,41,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,34,34,35,35,36,36,37,37,38,40,42,44,47,51,48,44,41,40,38,37,36,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,39,41,43,46,50,47,44,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,46,49,46,43,41,39,38,37,36,35,35,34,33,33,33,33,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,46,49,45,43,41,39,38,37,36,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,41,43,45,49,45,43,40,39,38,37,36,35,35,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,40,43,45,49,45,42,40,39,37,37,36,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,40,42,45,49,45,42,40,39,38,37,36,35,34,34,33,33,33,32,32,32,32,32,33,33,34,34,35,35,36,37,38,39,40,42,45,48,45,42,40,39,38,37,36,35,34,34,33,33,32,32,32,32,32,32,33,33,34,34,35,35,36,37,37,39,40,42,45,48,45,42,41,39,38,37,36,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,41,42,45,48,45,43,41,39,38,37,36,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,41,43,45,49,45,43,41,39,38,37,36,35,35,34,34,33,33,32,32,32,33,33,33,33,34,34,35,36,36,37,38,39,41,43,46,49,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,34,34,35,36,37,37,38,39,41,43,46,49,46,44,41,39,38,37,36,35,35,34,34,34,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,39,41,44,47,50,47,44,42,40,38,37,37,36,35,35,34,34,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,40,42,44,47,50,47,45,42,40,39,38,37,36,35,35,34,34,34,33,33,33,33,33,34,34,35,35,36,36,37,38,39,40,42,45,48,51,49,45,43,41,39,38,37,36,35,35,35,34,34,34,33,34,34,34,34,34,35,35,36,36,37,38,39,41,43,45,48,52,51,47,43,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,35,35,35,36,37,37,38,39,41,43,46,49,53,53,48,44,42,40,39,38,37,36,36,35,35,34,34,34,34,34,34,34,35,35,36,36,37,38,39,40,42,44,47,50,54,56,50,45,42,41,39,38,37,36,36,36,35,35,35,34,34,35,34,35,35,36,36,37,37,38,39,41,42,45,48,51,56,61,52,46,43,41,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,36,36,37,38,38,40,41,43,45,49,52,57,67,55,47,44,42,40,39,38,37,37,36,36,36,35,35,35,35,35,36,36,36,37,37,38,39,40,42,44,47,50,54,59,76,60,49,45,43,41,40,39,38,37,37,36,36,36,36,36,36,36,36,36,37,37,38,39,40,41,43,45,48,51,57,63,85,61,50,45,43,42,40,39,38,38,37,37,36,36,36,36,36,36,36,37,37,38,38,39,40,42,44,46,49,53,59,67};

// CALIBRATION_SHADING_LS_TL84_G
static uint8_t _calibration_shading_ls_tl84_g[] = {100,65,50,43,40,39,38,37,36,36,36,35,35,35,35,35,35,35,35,36,36,36,37,37,38,39,41,43,45,48,55,67,85,62,49,42,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,35,36,36,37,37,38,39,40,42,44,47,54,62,75,57,46,41,39,38,37,36,36,35,35,35,35,34,34,35,35,35,35,35,36,36,36,37,37,38,40,41,43,46,51,56,67,53,44,40,39,38,37,36,36,35,35,35,34,34,34,34,34,34,35,35,35,36,36,37,37,38,39,41,43,45,49,54,61,50,42,40,38,37,36,36,35,35,35,34,34,34,34,34,34,34,34,35,35,36,36,36,37,38,39,40,42,44,47,51,56,47,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,34,35,35,35,36,36,37,38,38,40,41,44,47,50,52,46,41,39,38,37,36,35,35,34,34,34,34,33,33,33,34,34,34,34,35,35,36,36,37,37,38,39,41,43,46,49,49,44,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,39,41,43,45,48,47,43,40,38,37,36,36,35,35,34,34,33,33,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,40,42,45,48,45,42,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,34,34,34,35,36,36,37,37,39,40,42,44,47,44,42,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,40,42,44,47,44,41,39,38,37,36,35,35,34,34,33,33,33,33,32,32,33,33,33,33,34,34,35,35,36,36,37,38,39,41,44,47,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,44,46,43,41,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,46,43,41,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,34,34,34,35,36,36,37,38,39,41,43,46,43,41,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,33,34,34,35,36,36,37,38,39,41,43,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,33,34,34,35,36,36,37,38,39,41,43,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,34,34,34,35,36,36,37,38,39,41,43,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,34,35,36,36,37,38,39,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,32,32,33,33,33,33,34,34,35,35,36,36,37,38,40,42,44,47,44,42,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,40,42,44,47,44,42,40,38,37,36,36,35,35,34,34,33,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,39,40,42,45,47,45,42,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,39,40,43,45,48,46,43,41,39,38,37,36,35,35,35,34,34,34,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,41,43,46,49,47,44,41,39,38,37,36,36,35,35,35,34,34,34,34,34,34,34,34,34,35,35,35,36,37,37,38,40,41,43,46,50,48,45,42,40,38,37,37,36,35,35,35,34,34,34,34,34,34,34,34,34,35,35,36,36,37,37,39,40,42,44,47,50,50,46,42,40,39,38,37,36,36,35,35,35,34,34,34,34,34,35,34,35,35,35,36,36,37,38,39,41,42,45,48,52,53,47,43,41,39,38,37,37,36,36,36,35,35,35,35,35,35,35,35,35,35,36,36,37,37,38,39,41,43,46,49,53,57,50,44,42,40,39,38,37,36,36,36,35,35,35,35,35,35,35,35,35,36,36,37,37,38,39,40,42,44,46,50,54,62,52,45,42,40,39,38,37,37,36,36,36,35,35,35,35,35,35,35,36,36,36,37,37,38,39,41,43,45,47,52,56,70,56,47,43,41,40,39,38,37,37,36,36,36,36,35,36,36,36,36,36,36,37,37,38,39,40,41,43,46,49,54,59,77,57,48,43,42,40,39,38,37,37,37,36,36,36,36,36,36,36,36,36,37,37,38,38,39,40,42,44,46,50,55,62};

// CALIBRATION_SHADING_LS_TL84_B
static uint8_t _calibration_shading_ls_tl84_b[] = {97,65,49,43,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,36,36,36,37,37,38,39,40,42,44,47,54,65,83,61,49,42,40,38,37,36,36,35,35,35,35,35,34,35,35,35,35,35,36,36,37,37,38,39,40,42,44,46,53,61,73,56,46,41,39,38,37,36,36,35,35,35,34,34,34,34,34,35,35,35,36,36,36,37,37,38,40,41,43,45,50,55,65,52,44,40,39,37,37,36,35,35,35,34,34,34,34,34,34,34,35,35,36,36,36,37,37,38,39,41,42,45,48,53,59,49,42,40,38,37,36,36,35,35,34,34,34,34,34,34,34,34,35,35,35,36,36,37,37,38,39,40,42,44,47,50,55,47,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,34,35,35,35,36,36,37,38,38,40,41,44,46,49,51,45,41,39,38,37,36,35,35,34,34,34,34,33,33,33,34,34,34,34,35,35,36,36,37,38,38,39,41,43,45,48,48,44,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,34,34,34,35,35,36,36,37,37,38,39,40,42,45,47,46,43,40,38,37,36,36,35,35,34,34,34,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,39,40,42,44,47,45,42,40,38,37,36,35,35,34,34,34,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,38,40,42,44,46,44,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,34,34,35,35,35,36,37,37,38,40,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,32,33,33,33,33,34,34,34,35,35,36,36,37,38,39,41,43,45,43,41,39,37,37,36,35,35,34,34,33,33,33,33,32,32,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,37,37,36,35,35,34,34,33,33,32,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,38,37,36,35,35,34,34,33,33,33,32,32,32,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,41,39,38,37,36,35,35,34,34,33,33,33,33,33,32,33,33,33,33,34,34,35,35,36,37,37,38,40,41,43,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,33,34,34,35,36,36,37,37,38,40,41,44,46,44,41,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,37,38,40,42,44,46,44,42,40,38,37,37,36,35,35,34,34,34,33,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,40,42,44,47,45,42,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,41,42,45,48,46,43,41,39,38,37,36,36,35,35,34,34,34,34,33,33,34,34,34,34,35,35,35,36,36,37,38,39,41,43,45,48,47,44,41,40,38,37,36,36,35,35,34,34,34,34,34,34,34,34,34,34,35,35,36,36,37,37,38,40,41,44,46,49,49,45,42,40,38,38,37,36,36,35,35,34,34,34,34,34,34,35,34,35,35,36,36,36,37,38,39,40,42,44,47,50,53,47,42,41,39,38,37,36,36,36,35,35,35,34,34,34,35,35,35,35,35,36,36,37,37,38,39,41,43,45,48,51,57,49,43,41,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,35,36,36,37,37,38,38,40,41,43,46,49,53,61,52,44,42,40,39,38,37,37,36,36,35,35,35,35,35,35,35,35,36,36,36,37,37,38,39,40,42,44,47,50,54,68,55,46,42,41,39,38,37,37,36,36,36,35,35,35,35,35,36,36,36,36,37,37,38,38,40,41,43,45,48,52,57,76,56,47,43,41,40,39,38,37,37,36,36,36,36,35,36,36,36,36,36,37,37,37,38,39,40,42,43,46,49,54,60};

// CALIBRATION_SHADING_LS_D65_R
static uint8_t _calibration_shading_ls_d65_r[] = {110,70,53,45,42,40,39,38,37,37,36,36,36,35,35,35,35,36,36,36,37,37,38,38,39,40,42,44,47,50,59,73,93,66,52,44,41,40,39,38,37,36,36,36,35,35,35,35,35,35,36,36,36,37,37,38,39,40,41,43,46,49,57,67,81,60,49,43,41,39,38,37,37,36,35,35,35,35,35,35,35,35,35,35,36,36,37,38,38,39,41,43,45,48,53,60,72,56,46,42,40,39,38,37,36,36,35,35,35,34,34,34,35,35,35,35,36,36,37,37,38,39,40,42,44,47,51,57,65,52,44,41,40,38,37,37,36,35,35,35,34,34,34,34,34,34,35,35,35,36,36,37,38,38,40,41,44,46,50,54,59,50,43,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,35,35,36,36,37,37,38,39,41,43,46,49,53,55,48,43,40,39,38,37,36,35,35,34,34,34,33,34,34,34,34,34,34,35,36,36,37,37,38,39,40,42,45,48,52,52,46,42,40,39,38,37,36,35,35,34,34,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,40,42,44,47,51,49,45,42,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,34,34,35,35,36,36,37,38,38,40,41,44,47,50,48,44,41,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,39,41,43,46,50,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,46,49,45,43,41,39,38,37,36,35,35,34,34,33,33,33,33,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,49,45,43,41,39,38,37,36,35,35,34,33,33,33,33,32,32,33,33,33,33,34,34,35,36,36,37,38,39,40,43,45,49,45,42,40,39,38,37,36,35,35,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,37,38,40,42,45,48,44,42,40,39,38,37,36,35,34,34,34,33,33,32,32,32,32,32,33,33,34,34,35,35,36,37,37,38,40,42,45,48,44,42,40,39,38,37,36,35,34,34,33,33,33,32,32,32,32,32,33,33,34,34,35,35,36,37,37,39,40,42,45,48,44,42,40,39,38,37,36,35,34,34,34,33,33,32,32,32,32,32,33,33,34,34,35,35,36,37,37,38,40,42,45,48,45,42,40,39,38,37,36,35,34,34,34,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,37,39,40,42,45,48,45,43,41,39,38,37,36,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,40,42,45,48,45,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,33,33,33,33,34,34,35,36,36,37,38,39,40,43,45,49,45,43,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,34,34,35,36,36,37,38,39,41,43,46,49,46,43,41,39,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,46,49,47,44,42,40,39,37,37,36,35,35,34,34,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,40,42,44,47,50,47,44,42,40,39,38,37,36,35,35,34,34,34,33,33,33,33,33,34,34,34,35,35,36,37,38,39,40,42,44,47,51,48,45,43,41,39,38,37,36,35,35,35,34,34,34,34,33,34,34,34,34,35,35,36,36,37,38,39,40,43,45,48,52,50,46,43,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,34,35,35,36,36,37,38,39,41,43,45,49,53,53,48,44,42,40,39,38,37,36,36,35,35,34,34,34,34,34,35,34,35,35,36,36,37,37,38,40,41,44,46,50,54,56,49,44,42,41,39,38,37,37,36,36,35,35,35,34,34,35,35,35,35,36,36,36,37,38,39,40,42,44,47,51,55,61,52,45,43,41,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,36,36,37,37,38,39,41,43,45,48,52,57,66,55,47,44,42,40,39,38,37,37,36,36,36,35,35,35,35,35,36,36,36,37,37,38,39,40,42,44,46,50,54,59,76,60,49,45,43,41,40,39,38,37,37,36,36,36,36,36,36,36,36,36,37,37,38,38,40,41,43,45,47,51,56,63,84,61,50,46,44,42,40,39,38,38,37,37,36,36,36,36,36,36,36,37,37,38,38,39,40,42,44,46,49,52,58,66};

// CALIBRATION_SHADING_LS_D65_G
static uint8_t _calibration_shading_ls_d65_g[] = {99,65,50,43,40,39,38,37,36,36,36,35,35,35,35,35,35,35,35,36,36,36,37,37,38,39,41,42,44,48,55,67,85,61,49,42,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,35,36,36,37,37,38,39,40,42,44,47,54,62,74,57,46,41,39,38,37,36,36,35,35,35,35,35,34,35,35,35,35,35,36,36,36,37,37,38,40,41,43,46,51,56,67,53,44,40,39,38,37,36,36,35,35,35,34,34,34,34,34,34,35,35,35,36,36,37,37,38,39,41,43,45,49,54,61,50,42,40,38,37,36,36,35,35,35,34,34,34,34,34,34,34,34,35,35,35,36,36,37,38,39,40,42,44,47,51,56,47,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,34,34,35,35,36,36,37,37,38,40,41,44,47,50,52,45,41,39,38,37,36,35,35,35,34,34,34,33,33,33,34,34,34,34,35,35,35,36,37,37,38,39,41,43,46,49,49,44,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,41,43,45,48,47,43,40,38,37,36,36,35,35,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,39,40,42,45,48,45,42,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,40,42,44,47,44,42,39,38,37,36,35,35,34,34,34,33,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,40,42,44,47,44,41,39,38,37,36,35,35,34,34,33,33,33,33,32,32,33,33,33,33,34,34,35,35,36,36,37,38,39,41,44,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,46,43,41,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,34,34,34,35,36,36,37,38,39,41,43,46,43,41,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,33,34,34,35,36,36,37,38,39,41,43,46,43,41,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,41,43,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,33,34,34,35,35,36,37,38,39,41,43,46,43,41,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,33,34,34,35,36,36,37,38,39,41,43,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,32,32,32,33,33,33,34,34,34,35,36,36,37,38,39,41,43,46,43,41,39,38,37,36,35,35,34,34,34,33,33,33,33,32,33,33,33,33,34,34,34,35,36,36,37,38,39,41,44,46,44,42,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,40,42,44,47,44,42,40,38,37,36,36,35,35,34,34,33,33,33,33,33,33,33,33,34,34,34,35,35,36,36,37,38,40,42,44,47,45,42,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,39,40,42,45,48,46,43,41,39,38,37,36,36,35,35,34,34,34,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,41,43,45,48,47,44,41,39,38,37,36,36,35,35,35,34,34,34,34,34,34,34,34,34,35,35,35,36,36,37,38,39,41,43,46,49,48,44,42,40,38,37,37,36,36,35,35,34,34,34,34,34,34,34,34,34,35,35,36,36,37,37,38,40,42,44,47,50,50,46,42,40,39,38,37,36,36,35,35,35,34,34,34,34,34,35,34,35,35,35,36,36,37,38,39,40,42,44,48,51,53,47,43,41,39,38,37,37,36,36,36,35,35,35,35,35,35,35,35,35,35,36,36,37,37,38,39,41,43,45,49,52,58,50,44,42,40,39,38,37,36,36,36,35,35,35,35,35,35,35,35,35,36,36,36,37,38,39,40,42,44,46,50,54,62,52,45,42,41,39,38,37,37,36,36,36,35,35,35,35,35,35,35,36,36,36,37,37,38,39,41,42,44,47,51,56,70,56,47,43,41,40,39,38,37,37,36,36,36,36,36,36,36,36,36,36,36,37,37,38,39,40,41,43,45,48,53,59,77,57,47,43,42,40,39,38,38,37,37,36,36,36,36,36,36,36,36,36,37,37,37,38,39,40,42,44,46,49,55,62};

// CALIBRATION_SHADING_LS_D65_B
static uint8_t _calibration_shading_ls_d65_b[] = {97,65,49,43,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,35,36,36,37,37,38,39,40,42,44,47,54,65,83,61,49,42,39,38,37,36,36,35,35,35,35,34,35,35,35,35,35,35,36,36,37,37,38,39,40,42,44,46,53,61,73,56,46,41,39,38,37,36,36,35,35,35,34,34,34,34,34,35,35,35,36,36,36,37,37,38,39,41,43,45,50,55,65,52,44,40,39,37,37,36,35,35,35,35,34,34,34,34,34,34,35,35,35,36,36,37,37,38,39,41,42,44,48,53,59,49,42,40,38,37,36,36,35,35,35,34,34,34,34,34,34,34,35,35,35,36,36,36,37,38,39,40,42,44,47,50,55,47,41,39,38,37,36,35,35,35,34,34,34,34,34,34,34,34,34,35,35,35,36,36,37,38,38,39,41,43,46,49,51,45,41,39,38,37,36,35,35,34,34,34,34,33,33,33,34,34,34,34,35,35,36,36,37,37,38,39,41,43,45,48,48,44,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,34,34,34,35,35,36,36,37,37,38,39,40,42,45,47,46,43,40,38,37,36,36,35,35,34,34,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,39,40,42,44,47,45,42,40,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,38,40,42,44,46,44,41,39,38,37,36,35,35,34,34,34,33,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,40,41,43,46,43,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,41,39,37,37,36,35,35,34,34,33,33,33,32,32,32,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,37,37,36,35,34,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,37,36,36,35,35,34,34,33,33,32,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,32,33,33,34,34,35,35,36,36,37,38,39,41,43,45,42,40,39,37,36,36,35,34,34,34,33,33,33,32,32,32,32,33,33,33,34,34,34,35,36,36,37,38,39,41,43,45,42,40,39,37,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,34,35,36,36,37,38,39,41,43,45,42,40,39,38,37,36,35,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,43,41,39,38,37,36,35,35,34,34,33,33,33,33,32,32,33,33,33,33,34,34,35,35,36,36,37,38,39,41,43,45,43,41,39,38,37,36,35,35,34,34,33,33,33,33,33,33,33,33,33,33,34,34,35,35,36,37,37,38,40,41,43,46,43,41,39,38,37,36,36,35,34,34,34,33,33,33,33,33,33,33,33,34,34,34,35,35,36,37,37,38,40,42,44,46,44,42,40,38,37,36,36,35,35,34,34,33,33,33,33,33,33,33,33,34,34,35,35,35,36,37,37,39,40,42,44,47,45,42,40,39,37,37,36,35,35,34,34,34,33,33,33,33,33,33,34,34,34,35,35,36,36,37,38,39,40,42,45,47,46,43,41,39,38,37,36,35,35,35,34,34,34,33,33,33,34,34,34,34,34,35,35,36,36,37,38,39,41,43,45,48,47,44,41,39,38,37,36,36,35,35,34,34,34,34,34,34,34,34,34,34,35,35,35,36,37,37,38,40,41,43,46,49,49,45,42,40,38,37,37,36,36,35,35,34,34,34,34,34,34,35,34,35,35,35,36,36,37,38,39,40,42,44,47,50,52,47,42,40,39,38,37,36,36,35,35,35,35,34,34,34,35,35,35,35,35,36,36,37,37,38,39,41,42,45,48,51,57,49,43,41,40,38,37,37,36,36,35,35,35,35,35,35,35,35,35,35,36,36,36,37,37,38,40,41,43,46,49,53,61,52,44,42,40,39,38,37,36,36,36,35,35,35,35,35,35,35,35,36,36,36,37,37,38,39,40,42,44,46,50,54,69,55,46,43,41,39,38,37,37,36,36,36,35,35,35,35,35,35,36,36,36,36,37,37,38,39,41,43,45,48,52,57,76,56,47,43,41,40,38,37,37,37,36,36,36,36,35,35,36,36,36,36,36,37,37,38,39,40,42,43,46,49,53,60};


// R G B
static uint16_t _calibration_awb_warming_ls_a[] = {268, 256, 271};

// R G B
static uint16_t _calibration_awb_warming_ls_d75[] = {268, 256, 271};

// R G B
static uint16_t _calibration_awb_warming_ls_d50[] = {268, 256, 271};

// CALIBRATION_NOISE_PROFILE
static uint8_t _calibration_noise_profile[] = {0, 0, 0, 0, 0, 0, 0, 0, 5, 18, 23, 27, 30, 33, 34, 36, 37, 39, 40, 41, 42, 43, 43, 44, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68};

// CALIBRATION_DEMOSAIC
static uint8_t _calibration_demosaic[] = {7, 23, 29, 33, 36, 38, 40, 42, 43, 44, 46, 47, 48, 49, 50, 50, 51, 52, 52, 53, 53, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74};

// 8-bit normalised noise profile for WDR stitching
static uint8_t _calibration_wdr_np_lut[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

// CALIBRATION_GAMMA
//static uint16_t _calibration_gamma[] = {0, 347, 539, 679, 794, 894, 982, 1062, 1136, 1204, 1268, 1329, 1386, 1441, 1493, 1543, 1591, 1638, 1683, 1726, 1768, 1809, 1849, 1888, 1926, 1963, 1999, 2034, 2068, 2102, 2135, 2168, 2200, 2231, 2262, 2292, 2322, 2351, 2380, 2408, 2436, 2463, 2491, 2517, 2544, 2570, 2596, 2621, 2646, 2671, 2695, 2719, 2743, 2767, 2790, 2814, 2836, 2859, 2882, 2904, 2926, 2948, 2969, 2990, 3012, 3033, 3053, 3074, 3094, 3115, 3135, 3155, 3174, 3194, 3213, 3233, 3252, 3271, 3290, 3308, 3327, 3345, 3364, 3382, 3400, 3418, 3436, 3453, 3471, 3488, 3506, 3523, 3540, 3557, 3574, 3591, 3607, 3624, 3640, 3657, 3673, 3689, 3705, 3721, 3737, 3753, 3769, 3785, 3800, 3816, 3831, 3846, 3862, 3877, 3892, 3907, 3922, 3937, 3951, 3966, 3981, 3995, 4010, 4024, 4039, 4053, 4067, 4081, 4095};
static uint16_t _calibration_gamma[] = {0, 474, 745, 941, 1097, 1227, 1338, 1433, 1516, 1589, 1653, 1711, 1763, 1811, 1854, 1896, 1934, 1971, 2006, 2039, 2072, 2103, 2134, 2164, 2194, 2223, 2252, 2279, 2305, 2331, 2356, 2380, 2405, 2428, 2451, 2474, 2497, 2519, 2541, 2563, 2585, 2607, 2629, 2650, 2672, 2693, 2714, 2734, 2754, 2774, 2794, 2814, 2833, 2853, 2872, 2892, 2910, 2929, 2949, 2967, 2985, 3004, 3022, 3040, 3058, 3076, 3094, 3112, 3129, 3147, 3165, 3182, 3199, 3217, 3234, 3251, 3268, 3285, 3303, 3319, 3336, 3353, 3370, 3387, 3403, 3420, 3437, 3453, 3470, 3486, 3503, 3519, 3535, 3551, 3568, 3584, 3600, 3616, 3632, 3648, 3664, 3680, 3696, 3712, 3727, 3743, 3759, 3775, 3791, 3807, 3822, 3837, 3853, 3869, 3884, 3899, 3915, 3930, 3945, 3960, 3976, 3990, 4006, 4020, 4036, 4051, 4065, 4080, 4095};

// CALIBRATION_IRIDIX_ASYMMETRY
static uint32_t _calibration_iridix_asymmetry[] = {
    0, 61184, 116961, 168002, 214899, 258115, 298084, 335172, 369653, 401797, 431862, 460022, 486454, 511335, 534791, 556919, 577880, 597720, 616568, 634473, 651529, 667785, 683305, 698153, 712346, 725978, 739050, 751610, 763706, 775355, 786587, 797451, 807931, 818091, 827947, 837499, 846780, 855820, 864604, 873180, 881532, 889708, 897708, 905532, 913213, 920733, 928141, 935421, 942589, 949645, 956621, 963501, 970317, 977053, 983742, 990366, 996942, 1003470, 1009982, 1016446, 1022894, 1029326, 1035742, 1042158, 1048575,
};

// CALIBRATION_CA_FILTER_MEM
static uint32_t _calibration_ca_filter_mem[] = {32768,229629,491259,4278943225,4279204855,4262689525,4246239220,4229788915,4213338610,4196888050,4197214450,4180763890,4164313330,4147928050,4131477235,4115091955,4098641140,4082190325,4082516470,4066065655,4066391800,4066652665,4066913530,4067239930,4067500795,4084473340,4101445885,4118418430,4152037375,4185721855,4219340544,4253025024};

// calibration_awb_scene_presets in the following order AWB_DAY_LIGHT AWB_CLOUDY AWB_INCANDESCENT AWB_FLOURESCENT AWB_TWILIGHT AWB_SHADE AWB_WARM_FLOURESCENT
static uint16_t _calibration_awb_scene_presets[7][2] = {
  { 256, 256 },
  { 324, 217 },
  { 177, 397 },
  { 227, 285 },
  { 227, 285 },
  { 366, 196 },
  { 188, 358 }};

// CALIBRATION_CA_CORRECTION: MIN_CORRECTION, MESH_WIDTH, MESH_HEIGHT
static uint16_t _calibration_ca_correction[] = {1, 64, 64};


// CALIBRATION_CA_CORRECTION_MEM
static uint16_t _calibration_ca_correction_mem[][10] = {
  { 65490, 65535, 65533, 65533, 59, 0, 5, 65517, 65535, 5 },
  { 65535, 65509, 65532, 4, 14, 26, 65531, 65523, 65535, 20 },
  { 65496, 65532, 65506, 0, 71, 33, 18, 65534, 65518, 65483 },
  { 65531, 65521, 65531, 65523, 15, 25, 21, 65523, 6, 65492 }};

static uint32_t _calibration_lut3d_mem[] = {0};

static uint32_t _calibration_decompander0_mem[] = {0, 32768, 65536, 98304, 131072, 163840, 196608, 229376, 262144, 294912, 327680, 360448, 393216, 425984, 458752, 491520, 524288, 557055, 589823, 622591, 655359, 688127, 720895, 753663, 786431, 819199, 851967, 884735, 917503, 950271, 983039, 1015807, 1048575};
static uint32_t _calibration_decompander1_mem[] = {0, 4096, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 45056, 49152, 53248, 57344, 61440, 65536, 69632, 73728, 77824, 81920, 86016, 90112, 94208, 98304, 102400, 106496, 110592, 114688, 118784, 122880, 126976, 131072, 135168, 139264, 143360, 147456, 151552, 155648, 159744, 163840, 167936, 172032, 176128, 180224, 184320, 188416, 192512, 196608, 200704, 204800, 208896, 212992, 217088, 221184, 225280, 229376, 233472, 237568, 241664, 245760, 249856, 253952, 258048, 262144, 266240, 270336, 274432, 278528, 282624, 286720, 290816, 294912, 299008, 303104, 307200, 311296, 315392, 319488, 323584, 327680, 331776, 335872, 339968, 344064, 348160, 352256, 356352, 360448, 364544, 368640, 372736, 376832, 380928, 385024, 389120, 393216, 397312, 401408, 405504, 409600, 413696, 417792, 421888, 425984, 430080, 434176, 438272, 442368, 446464, 450560, 454656, 458752, 462848, 466944, 471040, 475136, 479232, 483328, 487424, 491520, 495616, 499712, 503808, 507904, 512000, 516096, 520192, 524288, 528383, 532479, 536575, 540671, 544767, 548863, 552959, 557055, 561151, 565247, 569343, 573439, 577535, 581631, 585727, 589823, 593919, 598015, 602111, 606207, 610303, 614399, 618495, 622591, 626687, 630783, 634879, 638975, 643071, 647167, 651263, 655359, 659455, 663551, 667647, 671743, 675839, 679935, 684031, 688127, 692223, 696319, 700415, 704511, 708607, 712703, 716799, 720895, 724991, 729087, 733183, 737279, 741375, 745471, 749567, 753663, 757759, 761855, 765951, 770047, 774143, 778239, 782335, 786431, 790527, 794623, 798719, 802815, 806911, 811007, 815103, 819199, 823295, 827391, 831487, 835583, 839679, 843775, 847871, 851967, 856063, 860159, 864255, 868351, 872447, 876543, 880639, 884735, 888831, 892927, 897023, 901119, 905215, 909311, 913407, 917503, 921599, 925695, 929791, 933887, 937983, 942079, 946175, 950271, 954367, 958463, 962559, 966655, 970751, 974847, 978943, 983039, 987135, 991231, 995327, 999423, 1003519, 1007615, 1011711, 1015807, 1019903, 1023999, 1028095, 1032191, 1036287, 1040383, 1044479, 1048575};

// CALIBRATION_SHADING_RADIAL_R
static uint16_t _calibration_shading_radial_r[] = {4096, 4113, 4130, 4147, 4164, 4182, 4199, 4216, 4234, 4251, 4269, 4286, 4304, 4322, 4340, 4357, 4375, 4393, 4411, 4430, 4448, 4466, 4484, 4503, 4521, 4540, 4558, 4577, 4596, 4614, 4633, 4652, 4671, 4690, 4709, 4728, 4747, 4767, 4786, 4805, 4825, 4844, 4864, 4883, 4903, 4923, 4943, 4963, 4983, 5003, 5023, 5043, 5063, 5084, 5104, 5124, 5145, 5165, 5186, 5207, 5227, 5248, 5269, 5290, 5311, 5332, 5354, 5375, 5396, 5417, 5439, 5460, 5482, 5504, 5526, 5547, 5569, 5591, 5613, 5635, 5658, 5680, 5702, 5725, 5747, 5770, 5793, 5815, 5838, 5861, 5884, 5907, 5930, 5954, 5977, 6001, 6024, 6048, 6072, 6095, 6119, 6143, 6167, 6192, 6216, 6240, 6265, 6290, 6314, 6339, 6364, 6389, 6415, 6440, 6465, 6491, 6517, 6542, 6568, 6594, 6621, 6647, 6673, 6700, 6727, 6754, 6781, 6808, 6835};

// CALIBRATION_SHADING_RADIAL_G
static uint16_t _calibration_shading_radial_g[] = {4096, 4108, 4120, 4133, 4145, 4157, 4170, 4182, 4195, 4207, 4220, 4233, 4246, 4258, 4271, 4284, 4297, 4310, 4323, 4336, 4350, 4363, 4376, 4389, 4403, 4416, 4430, 4443, 4457, 4471, 4485, 4498, 4512, 4526, 4540, 4554, 4568, 4582, 4596, 4611, 4625, 4639, 4654, 4668, 4682, 4697, 4712, 4726, 4741, 4756, 4771, 4785, 4800, 4815, 4830, 4845, 4860, 4876, 4891, 4906, 4922, 4937, 4952, 4968, 4983, 4999, 5015, 5030, 5046, 5062, 5078, 5094, 5110, 5126, 5142, 5158, 5174, 5191, 5207, 5223, 5240, 5256, 5273, 5290, 5306, 5323, 5340, 5357, 5374, 5391, 5408, 5425, 5442, 5459, 5477, 5494, 5512, 5529, 5547, 5564, 5582, 5600, 5618, 5636, 5654, 5672, 5690, 5708, 5726, 5745, 5763, 5782, 5800, 5819, 5838, 5857, 5876, 5895, 5914, 5933, 5952, 5972, 5991, 6011, 6031, 6051, 6070, 6090, 6111};

// CALIBRATION_SHADING_RADIAL_B
static uint16_t _calibration_shading_radial_b[] = {4096, 4107, 4118, 4128, 4139, 4150, 4161, 4172, 4183, 4194, 4205, 4216, 4228, 4239, 4250, 4261, 4272, 4284, 4295, 4307, 4318, 4329, 4341, 4352, 4364, 4376, 4387, 4399, 4411, 4422, 4434, 4446, 4458, 4470, 4482, 4493, 4505, 4517, 4530, 4542, 4554, 4566, 4578, 4590, 4603, 4615, 4627, 4640, 4652, 4664, 4677, 4689, 4702, 4714, 4727, 4740, 4752, 4765, 4778, 4791, 4803, 4816, 4829, 4842, 4855, 4868, 4881, 4894, 4908, 4921, 4934, 4947, 4960, 4974, 4987, 5001, 5014, 5028, 5041, 5055, 5068, 5082, 5096, 5110, 5123, 5137, 5151, 5165, 5179, 5193, 5207, 5221, 5236, 5250, 5264, 5279, 5293, 5308, 5322, 5337, 5351, 5366, 5381, 5396, 5411, 5426, 5441, 5456, 5471, 5486, 5501, 5517, 5532, 5548, 5563, 5579, 5595, 5610, 5626, 5642, 5658, 5674, 5691, 5707, 5723, 5740, 5756, 5773, 5790};


static LookupTable calibration_shading_radial_r = {.ptr = _calibration_shading_radial_r, .rows = 1, .cols = sizeof( _calibration_shading_radial_r ) / sizeof( _calibration_shading_radial_r[0] ), .width = sizeof( _calibration_shading_radial_r[0] )};
static LookupTable calibration_shading_radial_g = {.ptr = _calibration_shading_radial_g, .rows = 1, .cols = sizeof( _calibration_shading_radial_g ) / sizeof( _calibration_shading_radial_g[0] ), .width = sizeof( _calibration_shading_radial_g[0] )};
static LookupTable calibration_shading_radial_b = {.ptr = _calibration_shading_radial_b, .rows = 1, .cols = sizeof( _calibration_shading_radial_b ) / sizeof( _calibration_shading_radial_b[0] ), .width = sizeof( _calibration_shading_radial_b[0] )};
static LookupTable calibration_decompander0_mem = {.ptr = _calibration_decompander0_mem, .rows = 1, .cols = sizeof( _calibration_decompander0_mem ) / sizeof( _calibration_decompander0_mem[0] ), .width = sizeof( _calibration_decompander0_mem[0] )};
static LookupTable calibration_decompander1_mem = {.ptr = _calibration_decompander1_mem, .rows = 1, .cols = sizeof( _calibration_decompander1_mem ) / sizeof( _calibration_decompander1_mem[0] ), .width = sizeof( _calibration_decompander1_mem[0] )};

static LookupTable calibration_awb_scene_presets = {.ptr = _calibration_awb_scene_presets, .cols = 2, .rows = sizeof( _calibration_awb_scene_presets ) / sizeof( _calibration_awb_scene_presets[0] ), .width = sizeof( _calibration_awb_scene_presets[0][0] )};
static LookupTable calibration_light_src = {.ptr = _calibration_light_src, .cols = 2, .rows = sizeof( _calibration_light_src ) / sizeof( _calibration_light_src[0] ), .width = sizeof( _calibration_light_src[0][0] )};
static LookupTable calibration_rg_pos = {.ptr = _calibration_rg_pos, .rows = 1, .cols = sizeof( _calibration_rg_pos ) / sizeof( _calibration_rg_pos[0] ), .width = sizeof( _calibration_rg_pos[0] )};
static LookupTable calibration_bg_pos = {.ptr = _calibration_bg_pos, .rows = 1, .cols = sizeof( _calibration_bg_pos ) / sizeof( _calibration_bg_pos[0] ), .width = sizeof( _calibration_bg_pos[0] )};
static LookupTable calibration_mesh_rgbg_weight = {.ptr = _calibration_mesh_rgbg_weight, .cols = 15, .rows = sizeof( _calibration_mesh_rgbg_weight ) / sizeof( _calibration_mesh_rgbg_weight[0] ), .width = sizeof( _calibration_mesh_rgbg_weight[0][0] )};
static LookupTable calibration_mesh_ls_weight = {.ptr = _calibration_mesh_ls_weight, .cols = 15, .rows = sizeof( _calibration_mesh_ls_weight ) / sizeof( _calibration_mesh_ls_weight[0] ), .width = sizeof( _calibration_mesh_ls_weight[0][0] )};
static LookupTable calibration_mesh_color_temperature = {.ptr = _calibration_mesh_color_temperature, .cols = 15, .rows = sizeof( _calibration_mesh_color_temperature ) / sizeof( _calibration_mesh_color_temperature[0] ), .width = sizeof( _calibration_mesh_color_temperature[0][0] )};
static LookupTable calibration_wb_strength = {.ptr = _calibration_wb_strength, .rows = 1, .cols = sizeof( _calibration_wb_strength ) / sizeof( _calibration_wb_strength[0] ), .width = sizeof( _calibration_wb_strength[0] )};
static LookupTable calibration_sky_lux_th = {.ptr = _calibration_sky_lux_th, .rows = 1, .cols = sizeof( _calibration_sky_lux_th ) / sizeof( _calibration_sky_lux_th[0] ), .width = sizeof( _calibration_sky_lux_th[0] )};
static LookupTable calibration_ct_rg_pos_calc = {.ptr = _calibration_ct_rg_pos_calc, .rows = 1, .cols = sizeof( _calibration_ct_rg_pos_calc ) / sizeof( _calibration_ct_rg_pos_calc[0] ), .width = sizeof( _calibration_ct_rg_pos_calc[0] )};
static LookupTable calibration_ct_bg_pos_calc = {.ptr = _calibration_ct_bg_pos_calc, .rows = 1, .cols = sizeof( _calibration_ct_bg_pos_calc ) / sizeof( _calibration_ct_bg_pos_calc[0] ), .width = sizeof( _calibration_ct_bg_pos_calc[0] )};
static LookupTable calibration_color_temp = {.ptr = _calibration_color_temp, .rows = 1, .cols = sizeof( _calibration_color_temp ) / sizeof( _calibration_color_temp[0] ), .width = sizeof( _calibration_color_temp[0] )};
static LookupTable calibration_ct65pos = {.ptr = _calibration_ct65pos, .rows = 1, .cols = sizeof( _calibration_ct65pos ) / sizeof( _calibration_ct65pos[0] ), .width = sizeof( _calibration_ct65pos[0] )};
static LookupTable calibration_ct40pos = {.ptr = _calibration_ct40pos, .rows = 1, .cols = sizeof( _calibration_ct40pos ) / sizeof( _calibration_ct40pos[0] ), .width = sizeof( _calibration_ct40pos[0] )};
static LookupTable calibration_ct30pos = {.ptr = _calibration_ct30pos, .rows = 1, .cols = sizeof( _calibration_ct30pos ) / sizeof( _calibration_ct30pos[0] ), .width = sizeof( _calibration_ct30pos[0] )};
static LookupTable calibration_evtolux_ev_lut = {.ptr = _calibration_evtolux_ev_lut, .rows = 1, .cols = sizeof( _calibration_evtolux_ev_lut ) / sizeof( _calibration_evtolux_ev_lut[0] ), .width = sizeof( _calibration_evtolux_ev_lut[0] )};
static LookupTable calibration_evtolux_lux_lut = {.ptr = _calibration_evtolux_lux_lut, .rows = 1, .cols = sizeof( _calibration_evtolux_lux_lut ) / sizeof( _calibration_evtolux_lux_lut[0] ), .width = sizeof( _calibration_evtolux_lux_lut[0] )};
static LookupTable calibration_black_level_r = {.ptr = _calibration_black_level_r, .cols = 2, .rows = sizeof( _calibration_black_level_r ) / sizeof( _calibration_black_level_r[0] ), .width = sizeof( _calibration_black_level_r[0][0] )};
static LookupTable calibration_black_level_gr = {.ptr = _calibration_black_level_gr, .cols = 2, .rows = sizeof( _calibration_black_level_gr ) / sizeof( _calibration_black_level_gr[0] ), .width = sizeof( _calibration_black_level_gr[0][0] )};
static LookupTable calibration_black_level_gb = {.ptr = _calibration_black_level_gb, .cols = 2, .rows = sizeof( _calibration_black_level_gb ) / sizeof( _calibration_black_level_gb[0] ), .width = sizeof( _calibration_black_level_gb[0][0] )};
static LookupTable calibration_black_level_b = {.ptr = _calibration_black_level_b, .cols = 2, .rows = sizeof( _calibration_black_level_b ) / sizeof( _calibration_black_level_b[0] ), .width = sizeof( _calibration_black_level_b[0][0] )};
static LookupTable calibration_static_wb = {.ptr = _calibration_static_wb, .rows = 1, .cols = sizeof( _calibration_static_wb ) / sizeof( _calibration_static_wb[0] ), .width = sizeof( _calibration_static_wb[0] )};
static LookupTable calibration_mt_absolute_ls_a_ccm = {.ptr = _calibration_mt_absolute_ls_a_ccm, .rows = 1, .cols = sizeof( _calibration_mt_absolute_ls_a_ccm ) / sizeof( _calibration_mt_absolute_ls_a_ccm[0] ), .width = sizeof( _calibration_mt_absolute_ls_a_ccm[0] )};
static LookupTable calibration_mt_absolute_ls_d40_ccm = {.ptr = _calibration_mt_absolute_ls_d40_ccm, .rows = 1, .cols = sizeof( _calibration_mt_absolute_ls_d40_ccm ) / sizeof( _calibration_mt_absolute_ls_d40_ccm[0] ), .width = sizeof( _calibration_mt_absolute_ls_d40_ccm[0] )};
static LookupTable calibration_mt_absolute_ls_d50_ccm = {.ptr = _calibration_mt_absolute_ls_d50_ccm, .rows = 1, .cols = sizeof( _calibration_mt_absolute_ls_d50_ccm ) / sizeof( _calibration_mt_absolute_ls_d50_ccm[0] ), .width = sizeof( _calibration_mt_absolute_ls_d50_ccm[0] )};
static LookupTable calibration_shading_ls_a_r = {.ptr = _calibration_shading_ls_a_r, .rows = 1, .cols = sizeof( _calibration_shading_ls_a_r ) / sizeof( _calibration_shading_ls_a_r[0] ), .width = sizeof( _calibration_shading_ls_a_r[0] )};
static LookupTable calibration_shading_ls_a_g = {.ptr = _calibration_shading_ls_a_g, .rows = 1, .cols = sizeof( _calibration_shading_ls_a_g ) / sizeof( _calibration_shading_ls_a_g[0] ), .width = sizeof( _calibration_shading_ls_a_g[0] )};
static LookupTable calibration_shading_ls_a_b = {.ptr = _calibration_shading_ls_a_b, .rows = 1, .cols = sizeof( _calibration_shading_ls_a_b ) / sizeof( _calibration_shading_ls_a_b[0] ), .width = sizeof( _calibration_shading_ls_a_b[0] )};
static LookupTable calibration_shading_ls_tl84_r = {.ptr = _calibration_shading_ls_tl84_r, .rows = 1, .cols = sizeof( _calibration_shading_ls_tl84_r ) / sizeof( _calibration_shading_ls_tl84_r[0] ), .width = sizeof( _calibration_shading_ls_tl84_r[0] )};
static LookupTable calibration_shading_ls_tl84_g = {.ptr = _calibration_shading_ls_tl84_g, .rows = 1, .cols = sizeof( _calibration_shading_ls_tl84_g ) / sizeof( _calibration_shading_ls_tl84_g[0] ), .width = sizeof( _calibration_shading_ls_tl84_g[0] )};
static LookupTable calibration_shading_ls_tl84_b = {.ptr = _calibration_shading_ls_tl84_b, .rows = 1, .cols = sizeof( _calibration_shading_ls_tl84_b ) / sizeof( _calibration_shading_ls_tl84_b[0] ), .width = sizeof( _calibration_shading_ls_tl84_b[0] )};
static LookupTable calibration_shading_ls_d65_r = {.ptr = _calibration_shading_ls_d65_r, .rows = 1, .cols = sizeof( _calibration_shading_ls_d65_r ) / sizeof( _calibration_shading_ls_d65_r[0] ), .width = sizeof( _calibration_shading_ls_d65_r[0] )};
static LookupTable calibration_shading_ls_d65_g = {.ptr = _calibration_shading_ls_d65_g, .rows = 1, .cols = sizeof( _calibration_shading_ls_d65_g ) / sizeof( _calibration_shading_ls_d65_g[0] ), .width = sizeof( _calibration_shading_ls_d65_g[0] )};
static LookupTable calibration_shading_ls_d65_b = {.ptr = _calibration_shading_ls_d65_b, .rows = 1, .cols = sizeof( _calibration_shading_ls_d65_b ) / sizeof( _calibration_shading_ls_d65_b[0] ), .width = sizeof( _calibration_shading_ls_d65_b[0] )};
static LookupTable calibration_awb_warming_ls_a = {.ptr = _calibration_awb_warming_ls_a, .rows = 1, .cols = sizeof( _calibration_awb_warming_ls_a ) / sizeof( _calibration_awb_warming_ls_a[0] ), .width = sizeof( _calibration_awb_warming_ls_a[0] )};
static LookupTable calibration_awb_warming_ls_d50 = {.ptr = _calibration_awb_warming_ls_d50, .rows = 1, .cols = sizeof( _calibration_awb_warming_ls_d50 ) / sizeof( _calibration_awb_warming_ls_d50[0] ), .width = sizeof( _calibration_awb_warming_ls_d50[0] )};
static LookupTable calibration_awb_warming_ls_d75 = {.ptr = _calibration_awb_warming_ls_d75, .rows = 1, .cols = sizeof( _calibration_awb_warming_ls_d75 ) / sizeof( _calibration_awb_warming_ls_d75[0] ), .width = sizeof( _calibration_awb_warming_ls_d75[0] )};
static LookupTable calibration_noise_profile = {.ptr = _calibration_noise_profile, .rows = 1, .cols = sizeof( _calibration_noise_profile ) / sizeof( _calibration_noise_profile[0] ), .width = sizeof( _calibration_noise_profile[0] )};
static LookupTable calibration_demosaic = {.ptr = _calibration_demosaic, .rows = 1, .cols = sizeof( _calibration_demosaic ) / sizeof( _calibration_demosaic[0] ), .width = sizeof( _calibration_demosaic[0] )};
static LookupTable calibration_wdr_np_lut = {.ptr = _calibration_wdr_np_lut, .rows = 1, .cols = sizeof( _calibration_wdr_np_lut ) / sizeof( _calibration_wdr_np_lut[0] ), .width = sizeof( _calibration_wdr_np_lut[0] )};
static LookupTable calibration_gamma = {.ptr = _calibration_gamma, .rows = 1, .cols = sizeof( _calibration_gamma ) / sizeof( _calibration_gamma[0] ), .width = sizeof( _calibration_gamma[0] )};
static LookupTable calibration_iridix_asymmetry = {.ptr = _calibration_iridix_asymmetry, .rows = 1, .cols = sizeof( _calibration_iridix_asymmetry ) / sizeof( _calibration_iridix_asymmetry[0] ), .width = sizeof( _calibration_iridix_asymmetry[0] )};
static LookupTable calibration_ca_filter_mem = {.ptr = _calibration_ca_filter_mem, .rows = 1, .cols = sizeof( _calibration_ca_filter_mem ) / sizeof( _calibration_ca_filter_mem[0] ), .width = sizeof( _calibration_ca_filter_mem[0] )};
static LookupTable calibration_ca_correction = {.ptr = _calibration_ca_correction, .rows = 1, .cols = sizeof( _calibration_ca_correction ) / sizeof( _calibration_ca_correction[0] ), .width = sizeof( _calibration_ca_correction[0] )};
static LookupTable calibration_ca_correction_mem = {.ptr = _calibration_ca_correction_mem, .cols = 10, .rows = sizeof( _calibration_ca_correction_mem ) / sizeof( _calibration_ca_correction_mem[0] ), .width = sizeof( _calibration_ca_correction_mem[0][0] )};
static LookupTable calibration_lut3d_mem = {.ptr = _calibration_lut3d_mem, .rows = 1, .cols = sizeof( _calibration_lut3d_mem ) / sizeof( _calibration_lut3d_mem[0] ), .width = sizeof( _calibration_lut3d_mem[0] )};

uint32_t get_calibrations_static_fs_lin_os08a10_ipc( ACameraCalibrations *c )
{
    uint32_t result = 0;
    if ( c != 0 ) {
        c->calibrations[CALIBRATION_SHADING_RADIAL_R] = &calibration_shading_radial_r;
        c->calibrations[CALIBRATION_SHADING_RADIAL_G] = &calibration_shading_radial_g;
        c->calibrations[CALIBRATION_SHADING_RADIAL_B] = &calibration_shading_radial_b;
        c->calibrations[CALIBRATION_DECOMPANDER0_MEM] = &calibration_decompander0_mem;
        c->calibrations[CALIBRATION_DECOMPANDER1_MEM] = &calibration_decompander1_mem;
        c->calibrations[CALIBRATION_LIGHT_SRC] = &calibration_light_src;
        c->calibrations[CALIBRATION_RG_POS] = &calibration_rg_pos;
        c->calibrations[CALIBRATION_BG_POS] = &calibration_bg_pos;
        c->calibrations[CALIBRATION_MESH_RGBG_WEIGHT] = &calibration_mesh_rgbg_weight;
        c->calibrations[CALIBRATION_MESH_LS_WEIGHT] = &calibration_mesh_ls_weight;
        c->calibrations[CALIBRATION_MESH_COLOR_TEMPERATURE] = &calibration_mesh_color_temperature;
        c->calibrations[CALIBRATION_WB_STRENGTH] = &calibration_wb_strength;
        c->calibrations[CALIBRATION_SKY_LUX_TH] = &calibration_sky_lux_th;
        c->calibrations[CALIBRATION_CT_RG_POS_CALC] = &calibration_ct_rg_pos_calc;
        c->calibrations[CALIBRATION_CT_BG_POS_CALC] = &calibration_ct_bg_pos_calc;
        c->calibrations[CALIBRATION_COLOR_TEMP] = &calibration_color_temp;
        c->calibrations[CALIBRATION_CT65POS] = &calibration_ct65pos;
        c->calibrations[CALIBRATION_CT40POS] = &calibration_ct40pos;
        c->calibrations[CALIBRATION_CT30POS] = &calibration_ct30pos;
        c->calibrations[CALIBRATION_EVTOLUX_EV_LUT] = &calibration_evtolux_ev_lut;
        c->calibrations[CALIBRATION_EVTOLUX_LUX_LUT] = &calibration_evtolux_lux_lut;
        c->calibrations[CALIBRATION_BLACK_LEVEL_R] = &calibration_black_level_r;
        c->calibrations[CALIBRATION_BLACK_LEVEL_GR] = &calibration_black_level_gr;
        c->calibrations[CALIBRATION_BLACK_LEVEL_GB] = &calibration_black_level_gb;
        c->calibrations[CALIBRATION_BLACK_LEVEL_B] = &calibration_black_level_b;
        c->calibrations[CALIBRATION_STATIC_WB] = &calibration_static_wb;
        c->calibrations[CALIBRATION_MT_ABSOLUTE_LS_A_CCM] = &calibration_mt_absolute_ls_a_ccm;
        c->calibrations[CALIBRATION_MT_ABSOLUTE_LS_D40_CCM] = &calibration_mt_absolute_ls_d40_ccm;
        c->calibrations[CALIBRATION_MT_ABSOLUTE_LS_D50_CCM] = &calibration_mt_absolute_ls_d50_ccm;
        c->calibrations[CALIBRATION_SHADING_LS_A_R] = &calibration_shading_ls_a_r;
        c->calibrations[CALIBRATION_SHADING_LS_A_G] = &calibration_shading_ls_a_g;
        c->calibrations[CALIBRATION_SHADING_LS_A_B] = &calibration_shading_ls_a_b;
        c->calibrations[CALIBRATION_SHADING_LS_TL84_R] = &calibration_shading_ls_tl84_r;
        c->calibrations[CALIBRATION_SHADING_LS_TL84_G] = &calibration_shading_ls_tl84_g;
        c->calibrations[CALIBRATION_SHADING_LS_TL84_B] = &calibration_shading_ls_tl84_b;
        c->calibrations[CALIBRATION_SHADING_LS_D65_R] = &calibration_shading_ls_d65_r;
        c->calibrations[CALIBRATION_SHADING_LS_D65_G] = &calibration_shading_ls_d65_g;
        c->calibrations[CALIBRATION_SHADING_LS_D65_B] = &calibration_shading_ls_d65_b;
        c->calibrations[CALIBRATION_AWB_WARMING_LS_A] = &calibration_awb_warming_ls_a;
        c->calibrations[CALIBRATION_AWB_WARMING_LS_D50] = &calibration_awb_warming_ls_d50;
        c->calibrations[CALIBRATION_AWB_WARMING_LS_D75] = &calibration_awb_warming_ls_d75;
        c->calibrations[CALIBRATION_NOISE_PROFILE] = &calibration_noise_profile;
        c->calibrations[CALIBRATION_DEMOSAIC] = &calibration_demosaic;
        c->calibrations[CALIBRATION_WDR_NP_LUT] = &calibration_wdr_np_lut;
        c->calibrations[CALIBRATION_GAMMA] = &calibration_gamma;
        c->calibrations[CALIBRATION_IRIDIX_ASYMMETRY] = &calibration_iridix_asymmetry;
        c->calibrations[CALIBRATION_AWB_SCENE_PRESETS] = &calibration_awb_scene_presets;
        c->calibrations[CALIBRATION_CA_FILTER_MEM] = &calibration_ca_filter_mem;
        c->calibrations[CALIBRATION_CA_CORRECTION] = &calibration_ca_correction;
        c->calibrations[CALIBRATION_CA_CORRECTION_MEM] = &calibration_ca_correction_mem;
        c->calibrations[CALIBRATION_LUT3D_MEM] = &calibration_lut3d_mem;
    } else {
        result = -1;
    }
    return result;
}
